/*
自己选择的路 ,跪着也要走完。朋友们 , 虽然这个世界日益浮躁起来,只
要能够为了当时纯粹的梦想和感动坚持努力下去 , 不管其它人怎么样,我
们也能够保持自己的本色走下去。
To the world , you will be a person , but to a person , you
will be the world .                               ——AKPower
*/
//作者:AKPower
//算法:
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
const ll maxn = 2e5 + 10;
ll c[2][maxn];
ll n, m;
// struct node
// {
//     ll l, r, x;
// } c1[maxn], c2[maxn];
// ll pl[maxn], pr[maxn];

ll lowbit(ll x)
{
    return x & (-x);
}

void update(ll pos, ll x, ll flag)
{
    while (pos <= n)
    {
        c[flag][pos] += x;
        pos += lowbit(pos);
    }
    return;
}

ll getsum(ll pos, ll flag)
{
    ll sum = 0;
    while (pos > 0)
    {
        sum += c[flag][pos];
        pos -= lowbit(pos);
    }
    return sum;
}

// bool cmd1(node a, node b)
// {
//     return a.l < b.l;
// }
// bool cmd2(node a, node b)
// {
//     return a.r < b.r;
// }

int main()
{
    IOS;
    cin >> n >> m;
    ll las = 0, cnt = 0;
    while (m--)
    {
        ll flag, l, r, x;
        cin >> flag;
        if (flag == 0)
        {
            cin >> l >> r >> x;
            update(l, (r - l + 1) * x, 0);
            update(r, (r - l + 1) * x, 1);

            // pl[l]=(r-l+1)*x;
            // pr[r]=pl[l];
        }
        else
        {
            cin >> x;
            ll ans = getsum(n, 0) - getsum(x, 0) + getsum(x - 1, 1);
            cout << ans << endl;
            // if (las == 0)
            // {
            //     sort(c1, c1 + cnt, cmd1);
            //     sort(c2, c2 + cnt, cmd2);
            //     las = 1;
            // }
        }
    }
    getchar();
    getchar();
    return 0;
}
